package com.develophelper.examples;

import com.alibaba.fastjson.JSON;
import com.aliyun.openservices.ons.api.SendResult;
import com.develophelper.aliyun.rocketmq.core.RocketMQTemplate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author snaildev
 * @date 2021/05/17
 **/
@Slf4j
@RestController
public class TestController {

    @Resource
    RocketMQTemplate rocketMQTemplate;

    @PostMapping("/sendMsg")
    public String sendMsg() {
        SendResult result = rocketMQTemplate.syncSend("luffy_e_association_task_dev:TEST_TAG", "lallalaal");
        return JSON.toJSONString(result);
    }
}
